VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "FORMB...Field Validation"
   ClientHeight    =   3090
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3090
   ScaleWidth      =   4680
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Command1 
      Caption         =   "Check field lengths"
      Height          =   735
      Left            =   1320
      TabIndex        =   0
      Top             =   840
      Width           =   2055
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Command1_Click()

Dim objFS As FileSystemObject
Set objFS = New FileSystemObject
Dim TextStream As Scripting.TextStream
Dim File As Scripting.File
Dim l As String
Dim i As Integer
Dim strTemp As String
Dim req As String

Dim strFilePath As String
strFilePath = "C:\Shane\Temp\Data\FORMB.C001149"


Set File = objFS.GetFile("C:\Shane\Temp\Data\FORMB.C001149")
Set TextStream = File.OpenAsTextStream(ForReading)
i = 0
Do While Not TextStream.AtEndOfStream
    strTemp = TextStream.ReadLine
    l = Len(strTemp)
    i = i + 1
    
    If l <> 1380 Then
        If l <> 63 Then
            If l <> 145 Then
                strTemp = Right(strTemp, Len(strTemp) - 1)
                req = Mid(strTemp, 1, 20)
                strTemp = Right(strTemp, Len(strTemp) - 20)
                MsgBox "Line " & i & " , request " & req & " is " & l & " characters long."
            End If
        End If
    End If
Loop
TextStream.Close

End Sub
